// pages/cation/cation.js
var app=getApp();
var WxParse = require('../../wxParse/wxParse.js');
Page({
  data: {
    
    // movies: [
    //   { url: '../../images/banner1.png' },
    //   { url: '../../images/banner1.png' },
    //   { url: '../../images/banner1.jpg' },
    // ],
    top:[
      {
        name: '需使用4G飞享套餐。赠送12GB流量，2400分钟通话',
        price: '132.00',
      }
    ],
    tcxx:[
      {
         mottom1:'省内流量:3G',
         mottom2: '国内通话:500分钟',
         mottom3: '光宽带:3G',
         mottom4: '套餐共享:3G',
         mottom5: '额外赠送:3G国内流量，高清机顶盒',       
      }
    ],
    blxx:[
      {
        mottom6: '身份证',
        mottom7: '光宽带:3G',
    
      }
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 500,
 
 
},
  kdyy: function (e) {
   
    wx.navigateTo({
      url: '../yuyue/yuyue?id=' + e.currentTarget.dataset.id
    })
  },
  tabFun: function (e) {
    //获取触发事件组件的dataset属性 
    var _datasetId = e.target.dataset.id;
    console.log("----" + _datasetId + "----");
    var _obj = {};
    _obj.curHdIndex = _datasetId;
    _obj.curBdIndex = _datasetId;
    this.setData({
      tabArr: _obj
    });
  },
  onLoad: function (options) {
    var that = this;
    wx.request({
      url: app.appUrl +'/goods/detail',
      data:{
        goodsid:options.id
      },
      success:function(res){
        var article = res.data.data.content
        WxParse.wxParse('article', 'html', article, that, 5)
        that.setData({
          movies:res.data.data.pics,
          data:res.data.data
        })
      }
    })
  },
 
  showModal: function (event) {
    var that = this;
    var id = event.currentTarget.id;
    var app = getApp();
    app.requestDetailid = id;
    var daifukuan = this.data.quanbu;
    wx.showModal({
      title: '提示',
      content: '您确定要取消当前订单吗？',
      success: function (res) {
        if (res.confirm) {
          console.log('用户点击确定')
          for (var i in daifukuan) {
            if (i == id) {
              console.log(id);
              daifukuan.splice(i, 1)
              that.setData({
                quanbu: daifukuan
              })
            }
          }
        } else {

        }
      }
    })
  },
  showModa2: function (event) {
    var that = this;
    var id = event.currentTarget.id;
    var app = getApp();
    app.requestDetailid = id;
    var daifukuan = this.data.dingdan1;
    wx.showModal({
      title: '提示',
      content: '您确定要取消当前订单吗？',
      success: function (res) {
        if (res.confirm) {
          console.log('用户点击确定')
          for (var i in daifukuan) {
            if (i == id) {
              console.log(id);
              daifukuan.splice(i, 1)
              that.setData({
                dingdan1: daifukuan
              })
            }
          }
        } else {

        }
      }
    })
  },

  start_order: function () {
    wx.navigateTo({
      url: '../order/order'
    })
  },
  start_confirm: function () {
    wx.navigateTo({
      url: '../confirm/confirm'
    })
  },
  start_evaluation: function () {
    wx.navigateTo({
      url: '../pingjia/pingjia'
    })
  },
  start_return: function () {
    wx.navigateTo({
      url: '../return/return'
    })
  },
  
}); 



